#include<bits/stdc++.h>
using namespace std;

int f[105], a[105];

int main()
{
	int n, x, y;
	cin>>n>>y;
	int k = 1;
	for(int i = 2;i <= n;i++)
	{
		cin>>x;
		a[k++] = x+y;
		y = x;
		cout<<a[k-1]<<" "<<a[k-1]<<endl;
	}
	f[1] = a[1];
	for(int i = 2;i < n;i++)
		f[i] = max(f[i-1], f[i-2]+a[i]);
	for(int i = 1;i <= n;i++)
		cout<<f[i]<<" ";
	return 0;
}

